<template>
  <!--某个用户余额变动明细 -->
  <el-dialog :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" width="1000px">
    <div class="table-box" v-loading="loading">
      <div style="height:calc(100% - 50px)">
        <!-- <userMoneyChangeList :listData="tableData.records"></userMoneyChangeList> -->
      </div>
        
        <div class="pages-box">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="queryParams.pageNum" :page-sizes="[10, 20, 30, 40, 50, 60]" :page-size="queryParams.pageSize"
            layout="total, prev, pager, next, jumper" :total="tableData.total"></el-pagination>
        </div>
    </div>
  </el-dialog>
</template>
<script>
import myMoneyApi from "@/api/financeCenter/myMoney.js";
// import userMoneyChangeList from "@/views/financialWorkbench/components/userMoneyChangeList.vue"
export default {
  name: "",
  components:{
    // userMoneyChangeList
  },
  data() {
    return {
      dialogVisible: false,
      loading: false,
      allUsers: [],
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        applicantTimeStart: "",
        applicantTimeEnd: "",
        dataType: "all",
        userId:''
      },
      tableData: {
        records: [],
        total: 0
      },
      timer:[],
      // 表单参数
      form: {
        accountId: '',
        account: "",
        checkTel: ""
      },
      title: "余额变动",
    };
  },
  created() {
    // this.getAllUserList()
  },
  methods: {
    // 打开弹窗
    open(userId) {
      this.queryParams.userId = userId
      this.loading = false
      this.dialogVisible = true;
      this.getList()
    },
    // 获取列表
    getList() {
      this.loading = true;
      if (this.timer && this.timer.length) {
        this.queryParams.payEndTimeStart = this.timer[0] + " 00:00:00"
        this.queryParams.payEndTimeEnd = this.timer[1] + ' 23:59:59'
      } else {
        this.queryParams.payEndTimeStart = ''
        this.queryParams.payEndTimeEnd = ''
      }
      myMoneyApi.getList(this.queryParams).then(response => {
        this.tableData.records = response.rows;
        this.tableData.total = response.total;
        this.loading = false;
      });
    },
    // 重置
    reset() {
      this.$refs.form.resetFields();
    },
    // 选择用户改变
    iotypeChange(e) {
      this.allUsers.forEach(r => {
        if (r.userId == e) {
          this.form.name = r.nickName
        }
      })
    },
    // 获取全部用户
    getAllUserList() {
      supplyConfigApi.getAllUserList().then(res => {
        this.allUsers = res.rows
      })
    },
    // 每页条数改变
    handleSizeChange(val) {
      this.queryParams.pageSize = val;
      this.getList();
    },
    // 页码改变
    handleCurrentChange(val) {
      this.queryParams.pageNum = val;
      this.getList();
    },
    close() {
      this.dialogVisible = false;
    }
  }
};
</script>
<style scoped lang="css">
.center {
  text-align: center;
}

.table-box {
  height: calc(100vh - 20vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
}
>>>.el-dialog__body{
  padding: 0;
}

</style>
